package com.usian.controller;

import com.usian.pojos.Course;
import com.usian.service.CourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@RequestMapping("/course")
@Controller
public class CourseController {

    @Autowired
    private CourseService courseService;

    @GetMapping("/findCourse")
    public String findCourse(Model model){

        List<Course> list = courseService.list();

        model.addAttribute("course",list);

        return "course";
    }
}
